package com.topvision.myviewtest.recycler.douyin;

import android.content.Context;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.PagerSnapHelper;
import android.support.v7.widget.RecyclerView;

/**
 * @author lucy
 * @date 2018-06-08 17:20
 * @description //TODO
 */

public class DouYinLayoutManager extends LinearLayoutManager {

    private PagerSnapHelper mPagerSnapHelper;
    private RecyclerView mRecyclerView;

    public DouYinLayoutManager(Context context) {
        this(context, LinearLayoutManager.VERTICAL, false);
    }

    public DouYinLayoutManager(Context context, int orientation, boolean reverseLayout) {
        super(context, orientation, reverseLayout);
        init();
    }

    private void init() {
        mPagerSnapHelper = new PagerSnapHelper();
    }

    @Override
    public void onAttachedToWindow(RecyclerView view) {
        super.onAttachedToWindow(view);
        mPagerSnapHelper.attachToRecyclerView(view);
        mRecyclerView = view;
    }
}
